using UnityEngine;
using UnityEditor;
using System.Collections.Generic;

public class WayPoints : MonoBehaviour {
	
	[MenuItem ("Mi Menu/Generar puntos")]
    static void GenerarPuntos() { 
		
		List<Vector3> lista = new List<Vector3>();
		
		GameObject objs1 = GameObject.FindGameObjectWithTag ("punto1");
		objs1.transform.rotation *= Quaternion.Euler(0,60,0);
		lista.Add( objs1.transform.position );
		GameObject objs2 = GameObject.FindGameObjectWithTag ("punto2");
		objs2.transform.rotation *= Quaternion.Euler(0,60,0);
		lista.Add( objs2.transform.position );
		GameObject objs3 = GameObject.FindGameObjectWithTag ("punto3");
		objs3.transform.rotation *= Quaternion.Euler(0,60,0);
		lista.Add( objs3.transform.position );
		GameObject objs4 = GameObject.FindGameObjectWithTag ("punto4");
		objs4.transform.rotation *= Quaternion.Euler(0,60,0);
		lista.Add( objs4.transform.position );
		GameObject objs5 = GameObject.FindGameObjectWithTag ("punto5");
		objs5.transform.rotation *= Quaternion.Euler(0,60,0);
		lista.Add( objs5.transform.position );

		//  descomentar si se necesitan mas puntos
/*		GameObject objs6 = GameObject.FindGameObjectWithTag ("punto6");
		objs6.transform.rotation *= Quaternion.Euler(0,60,0);
		lista.Add( objs6.transform.position );
		GameObject objs7 = GameObject.FindGameObjectWithTag ("punto7");
		objs7.transform.rotation *= Quaternion.Euler(0,60,0);
		lista.Add( objs7.transform.position );
		GameObject objs8 = GameObject.FindGameObjectWithTag ("punto8");
		objs8.transform.rotation *= Quaternion.Euler(0,60,0);
		lista.Add( objs8.transform.position );
*/		
		
		ColeccionPuntos puntos = ScriptableObject.CreateInstance<ColeccionPuntos>();
		puntos.m_puntos = lista.ToArray();
		AssetDatabase.CreateAsset( puntos, "Assets/ColeccionPuntos.asset" );
	}
	[MenuItem ("Mi Menu/Salvar Animacion")]
    static void SalvarAnimacion() { 
		if(Selection.activeObject is AnimationClip ){
			Object copia = Object.Instantiate( Selection.activeObject );
			AssetDatabase.CreateAsset( copia, "Assets/"+Selection.activeObject.name+".anim" );
		}
	}

}
